﻿using Microsoft.EntityFrameworkCore;
using rk310.DAL.Migrations;
using rk310.MODEL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace rk310.DAL
{
    public class Roomdal
    {
        public Roomdal(MyContext context)
        {
            Context = context;
        }

        public MyContext Context { get; }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="room"></param>
        /// <returns></returns>
        public int AddRoom(Room room)
        {
            try
            {
                Context.rooms.Add(room);
                return Context.SaveChanges();
            }
            catch (Exception)
            {

                throw;
            }

        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        public dynamic GetRoom()
        {
            try
            {
                return Context.rooms.ToList();
            }
            catch (Exception)
            {

                throw;
            }
            
        }
        





    }
}
